package com.risetechnology.data;

import java.io.Serializable;

import android.content.res.Resources;
import android.graphics.drawable.Drawable;

import com.risetechnology.utils.Utils;

public class Recipe implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = -3710254652228266524L;
	private int id;
	private String name;
	private String serves;
	private int mealType;
	private String description;
	private int rateId;
	private boolean isFav;
	private Drawable image;
	private String part1Name;
	private String part1Ingredients;
	private String part2Name;
	private String part2Ingredients;
	private String part3Name;
	private String part3Ingredients;
	private String part1MethodName;
	private String part1Method;
	private String part2MethodName;
	private String part2Method;
	private String part3MethodName;
	private String part3Method;
	private int packageID;
	private int isBlocked;
	private String servingOptions;

	public Recipe() {
		// TODO Auto-generated constructor stub
	}

	public Recipe(int id, String name, String serves, int mealType,
			String mainDescription, int rateId, boolean isFav, Drawable image,
			String part1Name, String part1Ingredients, String part2Name,
			String part2Ingredients, String part3Name, String part3Ingredients,
			String part1MethodName, String part1Method, String part2MethodName,
			String part2Method, String part3MethodName, String part3Method, int packageID, String servingOptions) {
		this.id = id;
		this.name = name;
		this.serves = serves;
		this.mealType = mealType;
		this.description = mainDescription;
		this.rateId = rateId;
		this.isFav = isFav;
		this.setImage(image);
		this.part1Name = part1Name;
		this.part1Ingredients = part1Ingredients;
		this.part2Name = part2Name;
		this.part2Ingredients = part2Ingredients;
		this.part3Name = part3Name;
		this.part3Ingredients = part3Ingredients;
		this.part1MethodName = part1MethodName;
		this.part1Method = part1Method;
		this.part2MethodName = part2MethodName;
		this.part2Method = part2Method;
		this.part3MethodName = part3MethodName;
		this.part3Method = part3Method;
		this.packageID = packageID;
		this.servingOptions = servingOptions;
	}

	
	
	public String getServingOptions() {
		return servingOptions;
	}

	public void setServingOptions(String servingOptions) {
		this.servingOptions = servingOptions;
	}

	/**
	 * @return the isBlocked
	 */
	public boolean isBlocked() {
		return isBlocked>0;
	}

	/**
	 * @param isBlocked the isBlocked to set
	 */
	public void setBlocked(boolean isBlocked) {
		if(isBlocked){
			this.isBlocked = 1;
		}else{
			this.isBlocked = 0;
		}
	}

	/**
	 * @return the packageID
	 */
	public int getPackageID() {
		return packageID;
	}

	/**
	 * @param packageID the packageID to set
	 */
	public void setPackageID(int packageID) {
		this.packageID = packageID;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getMainDescription() {
		return description;
	}

	public void setMainDescription(String mainDescription) {
		this.description = mainDescription;
	}

	public String getServes() {
		return serves;
	}

	public void setServes(String serves) {
		this.serves = serves;
	}

	public Drawable getImage() {
		return image;
	}

	public void setImage(Drawable image) {
		this.image = image;
	}

	public void setPictureData(Resources res, byte[] pictureData) {
		image = Utils.byteToDrawable(res, pictureData);
	}

	public byte[] getPictureData() {
		return Utils.drawableToByteArray(image);
	}

	public int getMealType() {
		return mealType;
	}

	public void setMealType(int mealType) {
		this.mealType = mealType;
	}

	public int getRateId() {
		return rateId;
	}

	public void setRateId(int rateId) {
		this.rateId = rateId;
	}

	public boolean isFav() {
		return isFav;
	}

	public void setFav(boolean isFav) {
		this.isFav = isFav;
	}

	public String getPart1Name() {
		return part1Name;
	}

	public void setPart1Name(String part1Name) {
		this.part1Name = part1Name;
	}

	public String getPart1Ingredients() {
		return part1Ingredients;
	}

	public void setPart1Ingredients(String part1Ingredients) {
		this.part1Ingredients = part1Ingredients;
	}

	public String getPart2Name() {
		return part2Name;
	}

	public void setPart2Name(String part2Name) {
		this.part2Name = part2Name;
	}

	public String getPart2Ingredients() {
		return part2Ingredients;
	}

	public void setPart2Ingredients(String part2Ingredients) {
		this.part2Ingredients = part2Ingredients;
	}

	public String getPart3Name() {
		return part3Name;
	}

	public void setPart3Name(String part3Name) {
		this.part3Name = part3Name;
	}

	public String getPart3Ingredients() {
		return part3Ingredients;
	}

	public void setPart3Ingredients(String part3Ingredients) {
		this.part3Ingredients = part3Ingredients;
	}

	public String getPart1MethodName() {
		return part1MethodName;
	}

	public void setPart1MethodName(String part1MethodName) {
		this.part1MethodName = part1MethodName;
	}

	public String getPart1Method() {
		return part1Method;
	}

	public void setPart1Method(String part1Method) {
		this.part1Method = part1Method;
	}

	public String getPart2MethodName() {
		return part2MethodName;
	}

	public void setPart2MethodName(String part2MethodName) {
		this.part2MethodName = part2MethodName;
	}

	public String getPart2Method() {
		return part2Method;
	}

	public void setPart2Method(String part2Method) {
		this.part2Method = part2Method;
	}

	public String getPart3MethodName() {
		return part3MethodName;
	}

	public void setPart3MethodName(String part3MethodName) {
		this.part3MethodName = part3MethodName;
	}

	public String getPart3Method() {
		return part3Method;
	}

	public void setPart3Method(String part3Method) {
		this.part3Method = part3Method;
	}

	@Override
	public boolean equals(Object o) {
		if (o instanceof Recipe) {
			return ((Recipe) o).id == id;
		}
		return super.equals(o);
	}

}
